﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace BK_CLIENT
{
    public partial class CREATE_ROOM : Form
    {
        private string listRoom;
        private CLIENT_FORM formStart;
        public CREATE_ROOM(CLIENT_FORM form,string lists)
        {
            InitializeComponent();
            listRoom = lists;
            formStart = form;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string roomName = textBoxGroupName.Text;
            int pos = listRoom.IndexOf(roomName);
            if(pos == -1)
            {
                formStart.listRoom += "$" + roomName;
                formStart.CreateRoom(roomName);
                this.Close();
            }
            else
            {
                MessageBox.Show("Phòng chat " + roomName + " đã tồn tại");
            }
        }
    }
}
